package com.ruoyi.app.task;
import com.ruoyi.app.domain.RelUserMember;
import com.ruoyi.app.mapper.RelUserMemberMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
/*
@description:
@ClassName RelUserTask
@author chen
@create 2025-04-02 1:01
@Version 1.0
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class RelUserTask
{
    final RelUserMemberMapper relUserMemberMapper;

    @Scheduled(cron = "*/1 * * * * ?")
    public void expirationRelUserTask()
    {
        List<RelUserMember> relUserMembers =
                    relUserMemberMapper.selectExpirationList();
        if(null != relUserMembers && relUserMembers.size() >0)
        {
            List<Long> collect = relUserMembers.stream()
                                    .map(RelUserMember::getId)
                                    .collect(Collectors.toList());
            relUserMemberMapper.expirationList(collect);
        }
    }
}
